package com.qys.livesMall.system.model.dto.sys;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * Created by IntelliJ IDEA.
 * User: dp
 * Date: 2023/06/06
 * Time: 11:13
 * DESCRIPTION: 层级分红信息
 */
@Data
public class H2SysShareConfigDTO {

    @Schema(name = "id", description = "统一分红配置ID")
    private Integer id;

    @Schema(name = "hierarchy", description = "层级")
    @NotNull(message = "Please enter the hierarchy")
    private Integer hierarchy;

    @Schema(name = "name", description = "层级名")
    @NotBlank(message = "Please enter the name hierarchy")
    private String name;

//    @Schema(name = "description", description = "层级名")
//    @NotBlank(message = "Please enter the description hierarchy")
//    private String description;

    @Schema(name = "dividendRatio", description = "分红比例")
    @NotNull(message = "lease enter the percentage of share out bonus")
    @Min(value = 0, message = "Dividend ratio must be greater than or equal to 0")
    @Max(value = 100, message = "The proportion of share out bonus is not greater than 100")
    private BigDecimal dividendRatio;

//    public void setDividendRatio(BigDecimal dividendRatio) {
//        this.dividendRatio = null == dividendRatio ? null : dividendRatio.divide(new BigDecimal("100"), 2, RoundingMode.DOWN);
//    }

    @Schema(name = "type", description = "类型(0店铺,1个人)")
    private Byte type;
}
